<?php
declare (strict_types=1);

namespace app\admin\controller\base;

use app\admin\controller\CommonController;
use app\common\model\BaseBanner;

class Banner extends CommonController
{
    protected $modelName = BaseBanner::MODEL_NAME;
    protected $alias = 'b';

    protected function getSearchDefaultSort(): array
    {
        return ["{$this->alias}.sort" => 'asc',];
    }

    protected function getFilterFields(): array
    {
        return ['id', 'pic', 'href', 'sort', 'update_time'];
    }

    protected function validateRule(array $data): array
    {
        return [
            'pic|' . lang('banner.pic') => 'require',
            'href|' . lang('banner.href') => 'require',
            'sort|' . lang('common.sort') => 'require',
        ];
    }
}
